﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using FC.Model;


namespace FC.ViewModel.TaskItemVMs
{
    public partial class TaskItemTemplateVM : BaseTemplateVM
    {
        [Display(Name = "标题")]
        public ExcelPropety Name_Excel = ExcelPropety.CreateProperty<TaskItem>(x => x.Name);
        [Display(Name = "任务描述")]
        public ExcelPropety Description_Excel = ExcelPropety.CreateProperty<TaskItem>(x => x.Description);
        public ExcelPropety Iteration_Excel = ExcelPropety.CreateProperty<TaskItem>(x => x.IterationId);
        public ExcelPropety FinishedUser_Excel = ExcelPropety.CreateProperty<TaskItem>(x => x.FinishedUserId);
        [Display(Name = "任务状态")]
        public ExcelPropety TaskStatus_Excel = ExcelPropety.CreateProperty<TaskItem>(x => x.TaskStatus);
        [Display(Name = "_Admin.Parent")]
        public ExcelPropety Parent_Excel = ExcelPropety.CreateProperty<TaskItem>(x => x.ParentId);

	    protected override void InitVM()
        {
            Iteration_Excel.DataType = ColumnDataType.ComboBox;
            Iteration_Excel.ListItems = DC.Set<Iteration>().GetSelectListItems(Wtm, y => y.Name);
            FinishedUser_Excel.DataType = ColumnDataType.ComboBox;
            FinishedUser_Excel.ListItems = DC.Set<FrameworkUser>().GetSelectListItems(Wtm, y => y.Name);
            Parent_Excel.DataType = ColumnDataType.ComboBox;
            Parent_Excel.ListItems = DC.Set<TaskItem>().GetSelectListItems(Wtm, y => y.Name);
        }

    }

    public class TaskItemImportVM : BaseImportVM<TaskItemTemplateVM, TaskItem>
    {

    }

}
